import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/home/home.vue'
import Cart from '../views/home/cart.vue'
import Cla from '../views/home/cla.vue'
import Index from '../views/home/index.vue'
import My from '../views/home/my.vue'
import Detail from '../views/detail/index.vue'
import Goods from '../views/goods/index.vue'
import Login from '../views/login/index.vue'
import Register from '../views/register/index.vue'
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {path: '/',redirect:'/register',},
    {path: '/home',name: 'home',component: Home,
      children:[
        {path: 'cart',name: 'cart',component: Cart,},
        {path: 'cla',name: 'cla',component: Cla,},
        {path: 'index',name: 'index',component: Index,},
        {path: 'my',name: 'my',component: My,},
      ]
    },
    {path: '/detail',name: 'detail',component: Detail,},
    {path: '/goods:id',name: 'goods',component: Goods,},
    {path: '/login',name: 'login',component: Login,},
    {path: '/register',name: 'register',component: Register,},
  ],
})

export default router
